package main

import (
	"encoding/json"
	"fmt"
)

// struct tag
type Sub struct {
	Company string   `json:"com"`     // 键转换
	Subject []string `json:"-"`       // 舍弃键
	Isok    bool     `json:",string"` // 转换为string
}

func main() {
	sub := Sub{"AB", []string{"A"}, false}
	res, _ := json.Marshal(sub)
	fmt.Println(string(res)) // {"com":"AB","Isok":"false"}
}
